local skels = {}


-- 收录标准和军争卡牌

-- 有点无语，标准牌堆这时候都没载入。我手动输入还不行吗
local standard_card_names = {
  "slash", "jink", "peach", "snatch", "dismantlement", "nullification", "duel", "collateral",
  "ex_nihilo", "savage_assault", "archery_attack", "god_salvation", "amazing_grace",

  "thunder__slash","fire__slash", "analeptic","iron_chain","fire_attack",
}


for _, card_name in ipairs(standard_card_names) do
  local nameZh = Fk:translate(card_name, "zh_CN")
  local nameAbbr = nameZh
  local len = nameAbbr:len()
  if len == 1 then
    nameAbbr = "印"..nameAbbr
  elseif len > 2 then
    nameAbbr = string.sub(nameAbbr, 1, 6)
  end
  local desc = "每轮限一次，你可以视为使用【"..nameZh.."】。"
  local skel_name = "rmt__xingjiang_"..card_name
  Fk:loadTranslationTable{
    [skel_name] = nameAbbr,
    [":"..skel_name] = desc,
  }

  local skel = fk.CreateSkill { name = skel_name }
  skel:addEffect("viewas", {
    anim_type = "drawcard",
    pattern = ".|.|.|.|"..card_name,
    card_filter = Util.FalseFunc,
    prompt = desc,
    view_as = function(self)
      local c = Fk:cloneCard(self.name:gsub("rmt__xingjiang_", ""))
      c.skillName = self.name
      -- 印的牌莫名其妙变成黑色，不知道为啥，故如此做
      c.color = Card.NoColor
      c.suit = Card.NoSuit
      c.number = 0
      return c
    end,
    before_use = function (self, player, use)
      player:broadcastSkillInvoke("rmt__xingjiang")
    end,
    enabled_at_play = function(self, player)
      return player:usedSkillTimes(self.name, Player.HistoryRound) == 0
    end,
    enabled_at_response = function (self, player, response)
      return not response and player:usedSkillTimes(self.name, Player.HistoryRound) == 0
    end,
    times = function (self, player)
      return 1 - player:usedSkillTimes(self.name, Player.HistoryRound)
    end,
  })
  skel:addLoseEffect(function (self, player)
    player:setSkillUseHistory(self.name, 0, Player.HistoryRound)
  end)
  table.insert(skels, skel)
end

-- 标准卡牌、封侯卡牌外的印不了，只能这样干
-- 20个备用
local modalWord = {"啥", "这", "那", "吧", "哈", "哦", "啊", "呀", "呃", "呢", "嘛", "吗", "嘿", "哼", "哎", "唉", "哟", "哇", "哩", "咯"}
for i, word in ipairs(modalWord) do
  local nameZh = "印"..word
  local skel_name = "rmt__xingjiang_"..i
  Fk:loadTranslationTable{
    [skel_name] = nameZh,
    [":"..skel_name] = "每轮限一次，你可以视为使用【？】。",
    [":"..skel_name.."_dyn"] = "每轮限一次，你可以视为使用【{1}】。",
  }

  local skel = fk.CreateSkill { name = skel_name }
  skel:addEffect("viewas", {
    pattern = ".",
    card_filter = Util.FalseFunc,
    prompt = function (self, player)
      local name = player:getMark(self.name)
      if name ~= 0 then
        return "每轮限一次，你可以视为使用【"..Fk:translate(name).."】。"
      end
      return ""
    end,
    view_as = function(self, player)
      local name = player:getMark(self.name)
      if name == 0 then return nil end
      local c = Fk:cloneCard(name)
      c.skillName = self.name
      return c
    end,
    before_use = function (self, player, use)
      player:broadcastSkillInvoke("rmt__xingjiang")
    end,
    enabled_at_play = function(self, player)
      if player:usedSkillTimes(self.name, Player.HistoryRound) == 0 then
        local name = player:getMark(self.name)
        if name ~= 0 then
          local card = Fk:cloneCard(name)
          card.skillName = self.name
          return player:canUse(card) and not player:prohibitUse(card)
        end
      end
    end,
    enabled_at_response = function (self, player, response)
      if not response and player:usedSkillTimes(self.name, Player.HistoryRound) == 0 and Fk.currentResponsePattern then
        local name = player:getMark(self.name)
        if name ~= 0 then
          return Exppattern:Parse(Fk.currentResponsePattern):matchExp(".|.|.|.|"..name)
        end
      end
    end,
    times = function (self, player)
      return 1 - player:usedSkillTimes(self.name, Player.HistoryRound)
    end,
    dynamic_desc = function (self, player, lang)
      local name = player:getMark(self.name)
      if name ~= 0 then
        return self.name.."_dyn:"..player:getMark(self.name)
      end
      return self.name
    end,
  })
  skel:addLoseEffect(function (self, player)
    player:setSkillUseHistory(self.name, 0, Player.HistoryRound)
    player.room:setPlayerMark(player, self.name, 0)
  end)
  table.insert(skels, skel)
end



return skels
